<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<head th:include="fragments/head::header" />
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <!--<div class="breadcrumbs" id="breadcrumbs">-->
                <!--<ul class="breadcrumb">-->
                    <!--<li>首页</li>-->
                    <!--<li>院校申请</li>-->
                    <!--<li>查询补件信息</li>-->
                    <!--&lt;!&ndash;<li class="active">内容列表</li>&ndash;&gt;-->
                <!--</ul>-->
            <!--</div>-->

            <div class="page-content">
                <h3 class="header smaller lighter blue">详细信息</h3>
                <div id="ulId" class=""></div>
                <br/>
                <input type="hidden" name="applyId" id="applyId" th:value="${#httpServletRequest.getParameter('applyId')}"/>
                <input type="hidden" name="studentNo" id="studentNo" th:value="${#httpServletRequest.getParameter('studentNo')}"/>
                <input type="hidden" id = "resDomain" th:value="${resDomain}"/>
                <div  class="tab-pane fade in active">
                    <div class="container">
                        <div class="form-horizontal">
                            <div class="form-group" style="height:29px">
                                <label class="col-sm-3 control-label no-padding-right blue" for="supplementType"> 寄件类型：</label>
                                <select type="" class="col-sm-3 form-control input-sm" id="supplementType" style="width:190px;height:25px;" disabled="disabled">
                                    <option value="1" th:selected="${supplementInfo!=null}? ${supplementInfo.supplementType==1}">首次递交</option>
                                    <option value="2" th:selected="${supplementInfo!=null}? ${supplementInfo.supplementType==2}">补件</option>
                                    <option value="3" th:selected="${supplementInfo!=null}? ${supplementInfo.supplementType==3}">邮寄最终成绩单/疫苗表日期</option>
                                    <option value="4" th:selected="${supplementInfo!=null}? ${supplementInfo.supplementType==4}">邮寄录取包裹</option>
                                </select>
                                <label class="col-sm-3 control-label no-padding-right blue" for="sendDate_string"> 送件日期：</label>
                                <input class="Wdate col-sm-3" style="width: 190px" readonly="readonly"
                                       th:value="${supplementInfo.sendDate!=null}?  ${#dates.format(supplementInfo.sendDate, 'yyyy-MM-dd HH:mm:ss')}"/>
                            </div>
                            <div class="form-group" style="height:29px">
                                <label class="col-sm-3 control-label no-padding-right blue" for="expressCompanyName"> 快递公司名称：</label>
                                <select type="" class="col-sm-3 form-control input-sm" id="expressCompanyName" style="width:190px;height:25px;" required="required" disabled="disabled">
                                    <option  th:each="express:${expressCompanyList}" th:value="${express.companyCode}"
                                             th:selected="${supplementInfo!=null}? ${express.companyCode==supplementInfo.expressCompanyCode}"  th:text="${express.companyName}"></option>
                                </select>
                                <label class="col-sm-3 control-label no-padding-right blue" for="expressNo"> 快递单号：</label>
                                <input class="col-sm-3" style="width: 190px" readonly="readonly" id="expressNo"
                                       th:value="${supplementInfo!=null}? ${supplementInfo.expressNo}"/>
                            </div>
                            <div class="form-group" style="height:29px">
                                <label class="col-sm-3 control-label no-padding-right blue" for="content"> 寄件内容：</label>
                                <input class="col-sm-2" id="content" th:value="${supplementInfo!=null}? ${supplementInfo.content}" readonly="readonly"/>
                            </div>
                            <div class="form-group" style="height:29px">
                                <input id="supplementAttachment" type="hidden" th:value="${supplementInfo!=null}? ${supplementInfo.supplementAttachment}"/>
                                <label class="col-sm-3 control-label no-padding-right blue" for="supplement_attachment" > 附件：</label>
                                <div class="col-sm-6" style="padding-left: 0px;">
                                    <div class="widget-header">
                                        <h4>文件上传</h4>
                                    </div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <span id = "offer_attachment" style="display: none"><span id = "offerAttachment_show" th:text="${supplementInfo!=null}? ${supplementInfo.supplementAttachment}"></span><span class="btn btn-sm btn-primary" style="left:50px" id = "offer_show">预览</span><a th:href="${supplementInfo!=null}? ${supplementInfo.supplementAttachment}" download="offer信息下载" ></a></span>
                                            <input name ="fileInput" multiple="" type="file" id="id-input-file-3" />
                                            <label>
                                                <input type="checkbox" name="file-format" id="id-file-format" class="ace" />
                                            </label>
                                            <span style="color: #FF2F2F">*上传文件的格式为&nbsp;:&nbsp;&nbsp; .jpg，&nbsp;.png，&nbsp;.gif,&nbsp;.doc，&nbsp;.docx，&nbsp;.pdf</span>
                                            <input name="privateAccess" type="hidden" value="true"/>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="returnPage">返回</button>
                    <!--<button type="button" class="btn btn-primary" id="submits">保存</button>-->
                </div>
            </div>
        </div>

        <div th:include="fragments/bottom::bottom"></div>
    </div>

    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>

<!-- Modal备注 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

        </div>
    </div>
</div>

<!-- Modal备注 -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <h2 style="color: green" id="result">审核通过</h2>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div>
    </div>
</div>

<div th:include="fragments/js::js"></div>

<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<script th:src="@{/js/common/uploadimg.js}" charset="UTF-8"></script>
<script th:src="@{/js/common/ajaxfileupload.js}" charset="UTF-8"></script>
<script th:src="@{/business/supplement/detail.js}" charset="UTF-8"></script>

<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>
<script th:src="@{/My97DatePicker/WdatePicker.js}"></script>

<script th:src="@{/js/upload/filePath.js}"></script>

<script th:src="@{/assets/js/chosen.jquery.min.js}"></script>
<script th:src="@{/assets/js/date-time/bootstrap-datepicker.min.js}"></script>
<script th:src="@{/assets/js/date-time/bootstrap-timepicker.min.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var data_offer = $("#supplementAttachment").val();

    $("#returnPage").click(function(){
        returnPage();
    });
    if(data_offer != null){
        $("#offerAttachment_show").text(data_offer.substring(0,50)+"...");
    }

    $("#offer_show").click(function () {
//        if ($("#supplementAttachment").val().indexOf($("#resDomain").val()) == -1) {
//            window.open($("#resDomain").val() + URLencode($("#supplementAttachment").val()));
//        } else {
//            window.open(URLencode($("#supplementAttachment").val()));
//        }
        $.post("/getPrivateUrl",{"fileUrl":$("#supplementAttachment").val()},function (data,status) {
            window.open(data);
        });
    });

    $("#offer_upload").click(function () {
        if ($("#supplementAttachment").val().indexOf($("#resDomain").val()) == -1) {
            $("#upload_office").attr("href", $("#resDomain").val() + URLencode($("#supplementAttachment").val()));
        } else {
            $("#upload_office").attr("href", URLencode($("#supplementAttachment").val()));
        }
    });

    $(function () {
        if(data_offer != ''){
            $("#upload_offer").attr("style","height:270px");
            $("#offer_attachment").show();
            $("input").attr("disabled", "disabled");
            upload()
        }else{
            $("input").attr("disabled", "disabled");
            upload()
        }
    })

function upload(){
    $('#id-input-file-3').ace_file_input({
        style:'well',
        btn_choose:'Drop files here or click to choose',
        btn_change:null,
        no_icon:'icon-cloud-upload',
        droppable:true,
        thumbnail:'small',//large | fit
        before_change:function(files, dropped) {
            return true;
        },
        before_remove : function() {
            return true;
        },
        preview_error : function(filename, error_code) {
            //name of the file that failed
            //error_code values
            //1 = 'FILE_LOAD_FAILED',
            //2 = 'IMAGE_LOAD_FAILED',
            //3 = 'THUMBNAIL_FAILED'
            //alert(error_code);
        }
    }).on('change', function(){
        //console.log($(this).data('ace_input_files'));
        //console.log($(this).data('ace_input_method'));
        $("#form_file").ajaxSubmit(function(message) {
            console.log(message);
            var fileName = message.obj;
            if(code == "1"){
                layer.msg("请上传正确的文件格式!")
            }else if(message.success){
                $("#input_fileName").val(fileName);
                layer.msg("上传成功!");
            }
//            if (message) {
//                $(".alert-success").text("上传成功").show();
//                $('#alert').attr('class', 'alert alert-success').show();
//                setTimeout("$('#alert').hide()", 2000);
//                $("#myModal").modal("hide");
//            } else {
//                $('#alertText').text('上传失败');
//                $('#alert').attr('class', 'alert alert-danger').show();
//                setTimeout("$('#alert').hide()", 2000);
//                $("#myModal").modal("hide");
//            }
        });
    });
}
    /*]]>*/
</script>
</body>
</html>
